home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
clipper
/
ks94an.zip
/
ALLFIELD.HDR
< prev
next >
Wrap
Text File
|
1994-04-25
|
2KB
|
78 lines
/******************************************************************************
The Klipper Library, for CA-Clipper 5.x
Copyright (c), 1994, Wallace Information Systems Engineering
FUNCTION:
_AllFields(cFileName,cSepChar,cFieldFunc) --> cFieldNameString
PARAMETERS:
cFileName : Name of database file to extract field names from
cSepChar : Delimiter character (Optional : ',' default)
cFieldFunc : Field Function (Optional : Default = none)
SHORT:
Create a string expression containing all database field names.
DESCRIPTION:
_AllFields() returns a string of all field names in the database
specified delimited with the character passed in cSepChar.
If cSepChar is not specified, the default delimiter is "," (comma).
cFieldFunc is a function to apply to each field name. If not specified,
no function is applied. The Field Name MUST be represented by <!> in order
to allow multiple function nesting around the field name. If there
were always to be a single function applied, you could simply specify the
name of the function and _allfields() could supply the necessary "()".
But since, in the case of "LTRIM(STR())", _allfields() will need to know
that the field name should be placed inside the first ")", not the last.
See example.
NOTE:
LTRIM(STR(<!>)) is different from SUBSTR(<!>,1,5) in placement of the
field name.
See examples.
If the specified database is open in any work area, _AllFields() switches
to that area, uses the file, creates the string and restores the
original current work area when done.
If the specified database is not open in any area, then the string
in cFileName is used as an explicit file name to open the database.
EXAMPLE:
Assume TEST.DBF is open in one of the open work areas. _AllFields() will use
the alias to SELECT the proper work area:
t = _AllFields('TEST')
Result: t = 'FIELD1,FIELD2,FIELD3'
Assume TEST.DBF is NOT open in ANY work area. In this case, you must supply
the DATABASE FILE NAME to be USED:
t = _AllFields('TEST.DBF','+')
Result: t = 'FIELD1+FIELD2+FIELD3'
// These two example specify a FIELD FUNCTION:
t = _AllFields("TEST.DBF",'+',"TRIM(<!>)")
Result: t = "TRIM(FIELD1)+TRIM(FIELD2)+TRIM(FIELD3)"
t = _AllFields("TEST.DBF",'+',"LTRIM(STR(<!>,0))")
Result: t = "LTRIM(STR(FIELD1,0))+LTRIM(STR(FIELD2,0))..." etc.
******************************************************************************/